package bugzillapreprocessor.adaptor;

import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * An adaptor class for printing data to a file.
 * 
 * @author c_haras
 */
public class PrinterAdapter {

	/**
	 * Print the given string the file with the given filename
	 * 
	 * @param filename
	 *            The filename of the file to save the string to
	 * @param str
	 *            The string to print to file
	 */
	public static void print(String filename, String str) {

		BufferedWriter out;
		try {
			out = new BufferedWriter(new FileWriter(filename));
			out.flush();
			out.write(str);
			out.close();

		} catch (IOException ex) {
			Logger.getLogger(PrinterAdapter.class.getName()).log(Level.SEVERE,
					null, ex);
		}
	}
}
